var SESSION_KEY = 'weapp_session_' + 'F2C224D4-2BCE-4C64-AF9F-A6D872000D1A';

var Session = {
	get: function(key = false) {
		if (key === false) {
			key = SESSION_KEY;
		}
		return uni.getStorageSync(key) || null;
	},

	set: function(session, key = false) {
		let _key = null;
		let _session = null;
		if (key) {
			_key = session;
			_session = key;
		} else {
			_session = session;
			_key = SESSION_KEY;
		}
		console.log(_key,_session);
		uni.setStorageSync(_key, _session);
	},

	clear: function(key = false) {
		if (key === false) {
			key = SESSION_KEY;
		}
		uni.removeStorageSync(key);
	},
};

module.exports = Session;
